<?php
namespace Goatherd\Content\Engine\Reader;

use Goatherd\Content\Engine\Queue\IItem;

/**
 * Buffered reader implementation.
 *
 * @category ContentEngine
 * @package Goatherd\Content\Engine
 * @subpackage Reader
 */
abstract class AbstractReader
implements IReader
{
    /**
     * (non-PHPdoc)
     * @see Goatherd\Content\Engine\Reader.IReader::connect()
     */
    public function connect() {}

    /**
     * (non-PHPdoc)
     * @see Goatherd\Content\Engine\Reader.IReader::disconnect()
     */
    public function disconnect() {}

    /**
     * (non-PHPdoc)
     * @see Goatherd\Content\Engine\Reader.IReader::get()
     */
    public function get(IItem $item)
    {
        $resource = $this->getResource($item);
        return ResourceContainer::create( $resource );
    }

    /**
     * Get actual resource.
     *
     * @param mixed $identifier
     * @return IResource
     */
    abstract public function getResource(IItem $item);
}